﻿    function sepClick(){
        var cWidth  = document.body.scrollWidth;
        var cHeight = document.body.scrollHeight;
        
        if (document.getElementById("divLeft").style.display == "none"){
            document.getElementById("divLeft").style.display = "";
            document.getElementById("divSep").style.left = 200;
            document.getElementById("divMain").style.left = 205;
            document.getElementById("divMain").style.width = cWidth - 205; 
        }else{
            document.getElementById("divLeft").style.display = "none";
            document.getElementById("divSep").style.left = 0;
            document.getElementById("divMain").style.left = 5;
            document.getElementById("divMain").style.width = cWidth ; 
        }
    }

    function ResizeWindows(){ //自动调整主窗体大小
        var cWidth  = document.body.scrollWidth;
        var cHeight = document.body.scrollHeight;
        
        document.getElementById("divTop").style.width  = cWidth-5;
        document.getElementById("divTop").style.height = "100px";
        
        document.getElementById("divLeft").style.width  =  "200px";
        document.getElementById("divLeft").style.height =  cHeight - 100;
        
        document.getElementById("divMain").style.width  = cWidth - 205 + "px";
        document.getElementById("divMain").style.height = cHeight - 100;
        
    }
    
    var tabbar;
    function CreateMainTab(divTabbar){  //创建Tab
        tabbar=new dhtmlXTabBar(divTabbar,"top");   
        tabbar.setImagePath("js/dhtmlxTabbar/imgs/");   //设置样式图片目录
        //tabbar.setStyle("modern");   //设置Tab样式
        tabbar.setHrefMode("iframes");//每一个Tab页对应一个新的iframe   
        tabbar.enableTabCloseButton(true);//显示关闭按钮
        tabbar.preventIECashing(true);//禁止IE缓存
        tabbar.enableAutoReSize(true);
    }
    
    function AddTab(tabId,tabName,url){ //新增Tab
    
            if (!validTab(tabId)) return;
            var tabId = tabId;
            var tabName = tabName;   
            tabbar.addTab(tabId,tabName,"100%");   
            tabbar.setContentHref(tabId,url);  
            tabbar.setTabActive(tabId,true);            
    }
    
    function validTab(tabId){ //校验Tab
    
         if (tabbar._getTabById(tabId)!=undefined) {
            tabbar.setTabActive(tabId,true);
            return false;
         }
         if (tabbar._checkSizes(0) > 3){
            alert("最多只能10个窗口同时运行，请关闭其他窗口！");
            return false;
         }
         return true;
         
    }
